<script src="../../main.js"></script>
<template>
    <div class="mine">
        <div class="mui-userCenter-info">
            <dl class="mui-portrait">
                <dt class="mui-portrait-icon"></dt>
                <div>
                <dd class="mui-user-name txt-ellipsis pr-60">HI，{{member.mobile}}</dd>
                <dd class="mui-user-id">UID: {{member.id}}</dd>
                <dd class="mui-user-id">邀请码: {{member.invite_code}}</dd>
                </div>
            </dl>
        </div>
        <div class="mui-list">
            <div class="mine-block" @click="$router.push('/c2')">
                <div class="ns1">
                    <img class="zb" src="../../assets/m_icon1.png" alt="">
                    <span>实名认证</span>
                </div>
                <img class="yb" src="../../assets/r-jt.png" alt="">
            </div>
            <div class="mine-block" @click="$router.push('/invite')">
                <div class="ns1">
                    <img class="zb" src="../../assets/m_icon2.png" alt="">
                    <span>我的邀请码</span>
                </div>
                <img class="yb" src="../../assets/r-jt.png" alt="">
            </div>
            <div class="mine-block" @click="$router.push('/safety')">
                <div class="ns1">
                    <img class="zb" src="../../assets/m_icon3.png" alt="">
                    <span>安全中心</span>
                </div>
                <img class="yb" src="../../assets/r-jt.png" alt="">
            </div>
            <div class="mine-block" @click="$router.push('/pay_list')">
                <div class="ns1">
                    <img class="zb" src="../../assets/m_icon4.png" alt="">
                    <span>支付账户</span>
                </div>
                <img class="yb" src="../../assets/r-jt.png" alt="">
            </div>
            <div class="mine-block" @click="$router.push('/brmoney')">
                <div class="ns1">
                    <img class="zb" src="../../assets/m_icon5.png" alt="">
                    <span>提币地址</span>
                </div>
                <img class="yb" src="../../assets/r-jt.png" alt="">
            </div>
            <div class="mine-block" @click="$router.push('/record')">
                <div class="ns1">
                    <img class="zb" src="../../assets/m_icon6.png" alt="">
                    <span>我的团队</span>
                </div>
                <img class="yb" src="../../assets/r-jt.png" alt="">
            </div>
            <!-- <div class="mine-block" @click="$router.push('')">
                <div class="ns1">
                    <img class="zb" src="../../assets/m_icon7.png" alt="">
                    <span>糖果记录</span>
                </div>
                <img class="yb" src="../../assets/r-jt.png" alt="">
            </div> -->
            <div class="mine-block" @click="$router.push('/messagelist')">
                <div class="ns1">
                    <img class="zb" src="../../assets/m_icon8.png" alt="">
                    <span>消息中心</span>
                </div>
                <img class="yb" src="../../assets/r-jt.png" alt="">
            </div>
            <div class="mine-block" @click="$router.push('/serve')">
                <div class="ns1">
                    <img class="zb" src="../../assets/m_icon9.png" alt="">
                    <span>客服问答</span>
                </div>
                <img class="yb" src="../../assets/r-jt.png" alt="">
            </div>
        </div>
        <div class="red_btn" @click="loginout">退出</div>
        <div style="height:1.333333rem"></div>
        <Tabbar :idx="4"/>
    </div>

</template>

<script>
// @ is an alias to /src
import Tabbar from '@/views/public/Tabbar.vue'

export default {
  name: 'asset',
  components: {
    Tabbar
  },
   data() {
    return {
        isActive:true,
        mrmc:true,
        show:false,
        member:[],
    }
  },
  created:function(){

  },
  mounted () {
      this.getmember();
  },
  methods: {
      loginout(){
          this.$axios.post("/index/apiindex/logout",
            {})
            .then(res => {
                 const toast = this.$createToast({
                        txt: res.data.message,
                        type:'txt'
                  });
                if(res.data.code==0){
                    toast.show();
                    sessionStorage.removeItem("islogin");
                    var exp = new Date();
                    exp.setTime(exp.getTime() + 1);
                    document.cookie = "islogin=false;expires=" + exp.toGMTString();
                    setTimeout(() => {
                            this.$router.push('/');
                    }, 1000);
                }else{
                    toast.show();
                }
            })
            .catch(function (error) {
                sessionStorage.removeItem("islogin");
                    var exp = new Date();
                    exp.setTime(exp.getTime() + 1);
                    document.cookie = "islogin=false;expires=" + exp.toGMTString();
                console.log(error);
                this.$createToast({
                        txt: "退出成功",
                        type:'txt',
                        time:1000
                  });
                setTimeout(() => {
                    this.$router.push('/');
                }, 1000);
            });
      },
      getmember(){
          this.$axios.post("/index/apiindex/homeIndex",
              {})
          // console.log(res)
              .then(res => {
                    console.log(1)
                  if(res.data.code == 0){
                      this.member = res.data.data;
                  }
                  console.log(this.member);
              })
              .catch(err=>{
                    // sessionStorage.removeItem("islogin");
                    // var exp = new Date();
                    // exp.setTime(exp.getTime() + 1);
                    // document.cookie = "islogin=false;expires=" + exp.toGMTString();
                    // setTimeout(() => {
                    //         this.$router.push('/');
                    // }, 1000);
              })
      },
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
    .f-flex{
        display: flex;
        display: -webkit-flex;
        align-items: center;
    }
    .red_btn{
        width: 92%;
        margin:1rem auto .2rem;
    }
    .p-padding{
        padding-left: 4%;
        padding-right: 4%;
    }
    .txt-ellipsis {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .pr-60 {
        padding-right: 1rem;
    }
    .mine{
       .mui-userCenter-info {
            position: relative;
            height: 0;
            padding-bottom: 60%;
            background: url(../../assets/mine_bg.png) no-repeat;
            background-size: 100% 100%;
           .mui-portrait {
                padding: 1.2rem .426667rem 0;
                .f-flex();

            }
           .mui-portrait-icon {
                float: left;
                margin-right: .426667rem;
                width: 1.733333rem;
                height: 1.733333rem;
                background: url(../../assets/touxiang.png) no-repeat;
                background-size: 100% 100%;
            }
            .mui-user-name {
                padding-top: .213333rem;
                font-size:.746667rem;
                color: #fff;
            }
           .mui-user-id {
                padding-top: .213333rem;
                font-size: .426667rem;
                color: #e8d3ca;
                text-align: left;
                line-height: 1.2
            }
        }
        .mine-block{
            padding: .4rem 0;
            border-bottom: 1px solid #f1f1f1;
            margin-top: .6rem;
            .ns1{
              .f-flex();
            }
            .f-flex();
            .p-padding();
            justify-content: space-between;
            .zb{
                width: .533333rem;
                height: .533333rem;
                margin-right: .2rem
            }
            span{
                font-size: .373333rem;
            }
            .yb{
                width: .25rem;
                height: .35rem;
            }
        }
    }
</style>

